//
//  CAOrderDetailAddressView.m
//  LNH
//
//  Created by twentylx on 2018/2/14.
//  Copyright © 2018年 twentylx. All rights reserved.
//

#import "CAOrderDetailAddressView.h"

@implementation CAOrderDetailAddressView

/**
 为视图绑定 viewModel
 
 @param viewModel 要绑定的ViewModel
 @param params 额外参数
 */
- (void)bindViewModel:(id <LMViewProtocol>)viewModel withParams:(NSDictionary *)params {
    
}

/**
 初始化额外数据
 */
- (void)lm_initializeForView {
    self.backgroundColor = [UIColor whiteColor];
}

/**
 初始化视图
 */
- (void)lm_createViewForView {
    [self setNeedsUpdateConstraints];
    
    [self addSubview:self.localImageView];
    [self addSubview:self.userLabel];
    [self addSubview:self.addressLabel];
}

#pragma mark layout
- (void)updateConstraints {
    [super updateConstraints];
    
    [self.localImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(20);
        make.centerY.equalTo(self);
    }];
    
    [self.userLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.localImageView.mas_right).offset(10);
        make.top.equalTo(self.localImageView).offset(-10);
    }];
    
    [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.localImageView.mas_right).offset(10);
        make.top.equalTo(self.userLabel.mas_bottom).offset(10);
        make.right.equalTo(self).offset(-10);
    }];
}

#pragma mark get & set
- (UIImageView *)localImageView {
    if (!_localImageView) {
        _localImageView = [UIImageView new];
        _localImageView.image = LMImageNamed(@"xgdz");
    }
    return _localImageView;
}

- (UILabel *)userLabel {
    if (!_userLabel) {
        _userLabel = [UILabel new];
        _userLabel.text = @"收货人：张三丰";
        _userLabel.textColor = RGBCOLOR(62, 58, 57);
        _userLabel.font = [UIFont systemFontOfSize:16];
    }
    return _userLabel;
}

- (UILabel *)addressLabel {
    if (!_addressLabel) {
        _addressLabel = [UILabel new];
        _addressLabel.text = @"收货地址：事实上开始卡手榴弹加速度阿萨德上开始卡手榴弹加速度阿萨德";
        _addressLabel.font = [UIFont systemFontOfSize:14];
        _addressLabel.numberOfLines = 2;
        _addressLabel.lineBreakMode = NSLineBreakByCharWrapping;
    }
    return _addressLabel;
}
@end
